function quickSort(arr) {
    // 1. 递归退出
    if (arr.length < 1) {
        return arr
    }
    // 2. 排序
    let middleIndex = Math.floor(arr.length / 2)
    let left = [];
    let right = [];
    console.log(arr, middleIndex)
    // let middle = arr[middleIndex]
    let middle = arr.splice(middleIndex, 1)[0]
    for (let i = 0; i < arr.length; i++) {
        if (arr[i] < middle) {
            left.push(arr[i])
        } else {
            right.push(arr[i])
        }
    }
    // 3. 拼接
    return quickSort(left).concat([middle], quickSort(right))
}